home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / Documentation / Development Notes / CodeWarrior 68K Problems < prev    next >
Encoding:
Text File  |  1996-04-26  |  2.6 KB  |  40 lines  |  [TEXT/ttxt]

  1. OpenDoc
  2. Development
  3. Framework
  4.                                                                                                                                                                                      
  5. CodeWarrior 68K Problems 
  6. ODF Release 1                                                                                                                                                             
  7.  
  8.  
  9. There is a known problem with Metrowerks CodeWarrior (CW8, v1.4.3) that results in incorrectly built 68K parts.  The parts will compile and link, but will have errors at runtime. The problem is that CodeWarrior currently does not honor the CFM68K calling conventions for returning 4-byte structs as a function result.  For example:
  10.  
  11. struct Point
  12. {
  13.     short x;
  14.     short y;
  15. };
  16.  
  17. Point GetPoint()
  18. {
  19.     Point result = {0,0};
  20.     return result;
  21. }
  22.  
  23. CFM68K calling conventions call for structs whose size is 4 bytes or less to be returned in register D0.  Structs of larger size are returned on the stack.  CodeWarrior currently returns all structs on the stack.
  24.  
  25. ODFLibrary defines several functions that return 4-byte structs as function results.  As it happens, none of these functions are needed to get a basic part up and running, so all of the ODF parts will launch.  However, most interesting parts will have a need for at least one of these functions.  For example, the ODFDraw drawing tools all depend on these functions.  ODFClock, on the other hand, does not require any of these functions and works fine.
  26.  
  27. There is another known problem that has an easy workaround.  The problem is with " #pragma import on/reset".  Specifically, "#pragma import reset" does not always correctly reset the import state.  This bug shows up as link errors against the SOM kernal functions.  If you run into this problem and wish to work around it, look at the link errors.  You should see "Unresolved reference to somSomething in file xxxxxx.cpp" (where "somSomething "is the unresolved function).  Open up the .cpp file and add a line like this after all of your #includes and before the first function:
  28.  
  29. #pragma import list somSomething
  30.  
  31. If more than one function is unresolved, you can list them separated by commas:
  32.  
  33. #pragma import list somSomething, somSomethingElse
  34.  
  35. Metrowerks is aware of these problems and plans to provide a netbourne fix.
  36.  
  37. NOTE: At the time of writing this document, CodeWarrior 9 is already final and will NOT have the necessary fix.  The netbourne fix will be an update to CW9.
  38.  
  39. © 1993 - 1996 Apple Computer, Inc. All rights reserved.
  40. Apple, the Apple Logo, Macintosh, and OpenDoc are trademarks of Apple Computer, Inc., registered in the United States and other countries.